<?php
	class Setting_Model extends CI_Model{
	  function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
	
	function seo(){
		$sql="SELECT * from tbl_setting where id_setting in ('1','2','3')";
		//echo $sql;
		$query=$this->db->query($sql);
		if ($query->num_rows()>0){
			return $query->result_array();
		}else{
			return array();
		}
	}
	
	function get_detail_data($id){
		$sql="SELECT * from tbl_setting where id_setting='".$id."'";
		//echo $sql;
		$query=$this->db->query($sql);
		if ($query->num_rows()>0){
			return $query->row_array();
		}else{
			return array();
		}
	}
	function insert_data($judul){
		
		$data=array('nama'=>$judul);
		$insert=$this->db->insert('tbl_setting',$data);
		return $insert;
	}
	
	function update_data($id,$konten){
		$data=array('konten'=>$konten);
		$this->db->where('id_setting',$id);
		$update=$this->db->update('tbl_setting',$data);
		return $update;
	}
	
	function delete_data($id){
		$data=array('id_setting'=>$id);
		$this->db->where($data);
		$delete=$this->db->delete('tbl_setting'); 
		return $delete;
	}
	
	function cek_client($id){
		$sql="SELECT * from tbl_client where id_setting='".$id."'";
		//echo $sql;
		$query=$this->db->query($sql);
		if ($query->num_rows()>0){
			return true;
		}else{
			return false;
		}
	}
	
	
	

}
?>